Conversation
| using Content.Shared.DoAfter; | ||
| using Content.Server.Temperature.Systems; | ||
|
|
||
| namespace Content.Server.Imperial.Medieval.Bonfire; |
There was a problem hiding this comment.
Система не понятно почему на сервере, это кринж
|
|
||
| public sealed class BonfireSystem : EntitySystem | ||
| { | ||
| [Dependency] protected readonly SharedAudioSystem _audio = default!; |
There was a problem hiding this comment.
зачем здесь протектед хз, нигде не наследуется
| [Dependency] protected readonly SharedAudioSystem _audio = default!; | |
| [Dependency] private readonly SharedAudioSystem _audio = default!; |
| [Dependency] private readonly TemperatureSystem _temperature = default!; | ||
| [Dependency] private readonly SharedDoAfterSystem _doAfterSystem = default!; | ||
|
|
||
| private const float FuelDecreasePerSecond = 0.11f; |
There was a problem hiding this comment.
Почему эти данные хардкодно зашиты в системе, а не находятся в компоненте - под вопросом.
Перенести в компонент по-хорошему
| } | ||
|
|
||
| bonfire.CurrentFuel = MathF.Max(0, bonfire.CurrentFuel - FuelDecreasePerSecond * frameTime); | ||
| UpdateBonfireVisuals(uid, bonfire); |
There was a problem hiding this comment.
каждый тик обновляется визуализация костра т.е. вызываются
_lights.SetEnergy(uid, energy);
_lights.SetRadius(uid, radius, light);
что потенциально может привести к лагам.
| { | ||
| if (component.IsLit == BonfireVisuals.Off) | ||
| { | ||
| args.PushText("Костёр не горит."); |
There was a problem hiding this comment.
Хардкод локализация.
Совет:
Loc.GetString("loc-key", ("var-name", component.IsLit == BonfireVisuals.Off));loc-key =
{ $var-name ->
[true] Тру
*[other] Фолс
}|
|
||
| EnsureComp<AmbientSoundComponent>(uid); | ||
|
|
||
| _ambientSound.SetSound(uid, new SoundPathSpecifier("/Audio/Ambience/Objects/fireplace.ogg")); |
There was a problem hiding this comment.
хардкод звук, должно быть в компоненте
| EnsureComp<PointLightComponent>(uid); | ||
|
|
||
| _lights.SetEnabled(uid, true); | ||
| _lights.SetColor(uid, Color.FromHex("#FFC90C")); |
There was a problem hiding this comment.
хардкод значения. Тож по хорошему должно быть в компоненте
| _ambientSound.SetAmbience(uid, true); | ||
|
|
||
| _appearance.SetData(uid, BonfireVisualLayers.Fire, true); | ||
| _audio.PlayPvs(new SoundPathSpecifier(component.IgnitionSound), uid); |
There was a problem hiding this comment.
Почему SoundPathSpecifier здесь, а не в компоненте?
| public sealed partial class BonfireComponent : Component | ||
| { | ||
| [DataField] | ||
| public string IgnitionSound = "/Audio/Items/Flare/flare_on.ogg"; |
There was a problem hiding this comment.
| public string IgnitionSound = "/Audio/Items/Flare/flare_on.ogg"; | |
| public SoundSpecifier IgnitionSound = new SoundPathSpecifier("/Audio/Items/Flare/flare_on.ogg"); |
| public string IgnitionSound = "/Audio/Items/Flare/flare_on.ogg"; | ||
|
|
||
| [DataField] | ||
| public string ExtinguishSound = "/Audio/Items/candle_blowing.ogg"; |
There was a problem hiding this comment.
То же самое что и IgnitionSound
О ПР`е
Технические детали
Изменения кода официальных разработчиков